<%@ page import="java.util.Date,com.apexedu.portal.constant.Constants" contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
    <title><%=Constants.ProjectInfo.PROJECT_NAME%>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <style>
        #contentSub {
            height: 320px;
        }
        .ystx{width: 200px;height: 320px;float: left;margin-left: 100px;margin-top: 50px;}
        .ystx label{width: 100%;float: left;height: 20px;line-height: 20px;font-size: 16px;text-align: center;}
        .ystx img{width: 200px;height: 200px;float: left;margin-top: 20px;}
        .upload{width: 300px;float: left;height: 320px;margin-top: 50px;position: relative;}
        .upload input{position: absolute;top: 68%;left: 10%;}
        .button button {
            margin-left: 35%;
            float: left;
        }

        .button span {
            float: left;
            line-height: 20px;
            display: block;
            font-size: 14px;
            color: red;
        }
    </style>
</head>
<body>

<div id="main">
    <jsp:include page="<%=Constants.ProjectInfo.HEAD_VIEW%>"/>
    <script>
        $(function () {
            $("button").click(function () {
                var fileName = $("input[name='files']").val();
                if ("" == fileName) {
                    alert("请选择要上传的图片文件！");
                    return;
                }
                var imgType=fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
                //判断上传文件格式是否正确
                if ( imgType!= '.jpg'&&imgType!=".png"&&imgType!=".gif"&&imgType!=".jpeg"&&imgType!='.bmp') {
                    alert("只能上传图片文件！");
                    return;
                }
                document.forms[0].submit();
            });
        });
    </script>
    <div id="content">
        <div id="contentSub">
            <div class="ystx">
                <label>用户头像</label>
                <img src="${basePath}/userinfo/${userid}?q=<%=new Date().getTime()%>" onerror="this.src='${basePath}/userinfo/user_male_portrait.png'">
            </div>
            <div class="upload" >
                <form method="post" enctype="multipart/form-data" class="form"
                      action="${basePath}/s/uc/mh/uhp">
                    <input type="file" name="files"/>
                </form>
            </div>
            <div style="clear: both;"></div>
            <div class="button">
                <button type="button">提交</button>
                <span>${ERROR}</span>
            </div>
        </div>
        <div id="contentBg"></div>
    </div>
    <jsp:include page="<%=Constants.ProjectInfo.FOOT_VIEW%>"/>
</div>
</body>
</html>
